package sk.stuba.fiit.clientApp.ws.client;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.ws.client.core.WebServiceTemplate;

import sk.stuba.fiit.pki.ws.schema.beans.TimestampRequest;
import sk.stuba.fiit.pki.ws.schema.beans.TimestampResponse;

/**
 * 
 * @author Marek Hruska
 *
 */
@Component
public class SignatureServiceClient {

	@Autowired
	private WebServiceTemplate timestampWsTemplate;

	
	public  TimestampResponse getTimeStamp(TimestampRequest request) {
		long start = System.currentTimeMillis();
		TimestampResponse response = (TimestampResponse) timestampWsTemplate.marshalSendAndReceive(request);
		long end = System.currentTimeMillis();
		long duration = end-start;
		System.out.println(duration);
		return response;
	}
	
}
